﻿// <copyright file="TeamAlertConfigurationSection.cs" company="http://www.dymetis.com">
//
// Copyright (c) 2011 Eddie Z. Lin.
//
// This source is subject to the Microsoft Public License.
// See http://www.opensource.org/licenses/ms-pl.
// All other rights reserved.
// 
// </copyright>

namespace Dymetis.TeamAlert.Configuration
{
    using System.ComponentModel;
    using System.Configuration;

    /// <summary>
    /// The TeamAlertConfigurationSection Configuration Section.
    /// </summary>
    public partial class TeamAlertConfigurationSection : ConfigurationSection
    {
        /// <summary>
        /// The XML name of the TeamAlertConfigurationSection Configuration Section.
        /// </summary>
        public const string TeamAlertConfigurationSectionSectionName = "TeamAlertConfigurationSection";

        /// <summary>
        /// The XML name of the <see cref="Xmlns"/> property.
        /// </summary>
        public const string XmlnsPropertyName = "xmlns";

        /// <summary>
        /// The XML name of the <see cref="AlertSettings"/> property.
        /// </summary>
        public const string AlertSettingsPropertyName = "alertSettings";

        /// <summary>
        /// The XML name of the <see cref="Alerts"/> property.
        /// </summary>
        public const string AlertsPropertyName = "alerts";

        /// <summary>
        /// Gets the TeamAlertConfigurationSection instance.
        /// </summary>
        public static TeamAlertConfigurationSection Instance
        {
            get
            {
                return (TeamAlertConfigurationSection)ConfigurationManager.GetSection(TeamAlertConfigurationSection.TeamAlertConfigurationSectionSectionName);
            }
        }

        /// <summary>
        /// Gets the XML namespace of this Configuration Section.
        /// </summary>
        /// <remarks>
        /// This property makes sure that if the configuration file contains the XML namespace,
        /// the parser doesn't throw an exception because it encounters the unknown "xmlns" attribute.
        /// </remarks>
        [ConfigurationProperty(TeamAlertConfigurationSection.XmlnsPropertyName, IsRequired = false, IsKey = false, IsDefaultCollection = false)]
        public string Xmlns
        {
            get
            {
                return (string)base[TeamAlertConfigurationSection.XmlnsPropertyName];
            }
        }

        /// <summary>
        /// Gets or sets the AlertSettings.
        /// </summary>
        [Description("The AlertSettings.")]
        [ConfigurationProperty(TeamAlertConfigurationSection.AlertSettingsPropertyName, IsRequired = false, IsKey = false, IsDefaultCollection = false)]
        public AlertSettingsConfigurationElement AlertSettings
        {
            get
            {
                return (AlertSettingsConfigurationElement)base[TeamAlertConfigurationSection.AlertSettingsPropertyName];
            }

            set
            {
                base[TeamAlertConfigurationSection.AlertSettingsPropertyName] = value;
            }
        }

        /// <summary>
        /// Gets or sets the Alerts.
        /// </summary>
        [Description("The Alerts.")]
        [ConfigurationProperty(TeamAlertConfigurationSection.AlertsPropertyName, IsRequired = false, IsKey = false, IsDefaultCollection = false)]
        public AlertConfigurationElementCollection Alerts
        {
            get
            {
                return (AlertConfigurationElementCollection)base[TeamAlertConfigurationSection.AlertsPropertyName];
            }

            set
            {
                base[TeamAlertConfigurationSection.AlertsPropertyName] = value;
            }
        }

        /// <summary>
        /// Gets a value indicating whether the element is read-only.
        /// </summary>
        /// <returns>
        /// A value indicating whether the element is read-only.
        /// </returns>
        public override bool IsReadOnly()
        {
            return false;
        }
    }
}
